/*   1:    */ package tt.dz.web.controller.channel;
/*   2:    */ 
/*   3:    */ import com.alibaba.fastjson.JSON;
/*   4:    */ import java.io.InputStreamReader;
/*   5:    */ import java.nio.charset.Charset;
/*   6:    */ import java.util.ArrayList;
/*   7:    */ import java.util.Arrays;
/*   8:    */ import java.util.HashMap;
/*   9:    */ import java.util.Iterator;
/*  10:    */ import java.util.List;
/*  11:    */ import java.util.Map;
/*  12:    */ import javax.annotation.Resource;
/*  13:    */ import javax.servlet.http.HttpServletRequest;
/*  14:    */ import javax.servlet.http.HttpServletResponse;
/*  15:    */ import javax.servlet.http.HttpSession;
/*  16:    */ import org.springframework.stereotype.Controller;
/*  17:    */ import org.springframework.web.bind.annotation.RequestMapping;
/*  18:    */ import org.springframework.web.bind.annotation.ResponseBody;
/*  19:    */ import org.springframework.web.multipart.MultipartFile;
/*  20:    */ import org.springframework.web.multipart.MultipartHttpServletRequest;
/*  21:    */ import org.springframework.web.multipart.commons.CommonsMultipartResolver;
/*  22:    */ import tt.dz.biz.service.channel.ChannelCheckService;
/*  23:    */ import tt.dz.common.CSVReadUtils;
/*  24:    */ import tt.dz.common.CSVReadUtils.CsvCellFormatHander;
/*  25:    */ import tt.dz.common.CSVReadUtils.ObjectCsvImportRowHander;
/*  26:    */ import tt.dz.common.LogUtil;
/*  27:    */ import tt.dz.vo.AlipayBillRecordVO;
/*  28:    */ import tt.dz.vo.ResponseModle;
/*  29:    */ import tt.dz.vo.UubeeBillRecordVO;
/*  30:    */ import tt.dz.vo.WechatBillRecordVO;
/*  31:    */ import tt.dz.web.controller.BaseController;
/*  32:    */ 
/*  33:    */ @Controller
/*  34:    */ public class ChannelCheckController
/*  35:    */   extends BaseController
/*  36:    */ {
/*  37:    */   @Resource(name="channelCheckService")
/*  38:    */   ChannelCheckService channelCheckService;
/*  39:    */   
/*  40:    */   @RequestMapping(value={"/aLiPayChannelCheckUpload"}, produces={"application/json;charset=UTF-8"})
/*  41:    */   @ResponseBody
/*  42:    */   public String aLiPayChannelCheckUpload(HttpServletRequest request, HttpServletResponse response)
/*  43:    */   {
/*  44: 46 */     Map<String, String> rs = new HashMap();
/*  45: 47 */     String[] headers = { "tranNo", "merchantOrder", "tradeCreateTime", "payTime", "recentUpdateTime", "tradeOrigin", "type", "tradeOpposite", "goodsName", "amount", "incomeExpenditure", "tradeState", "serviceCharge", "refundAmount", "remark" };
/*  46:    */     try
/*  47:    */     {
/*  48: 50 */       CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(request.getSession().getServletContext());
/*  49: 51 */       if (multipartResolver.isMultipart(request))
/*  50:    */       {
/*  51: 52 */         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
/*  52: 53 */         Iterator<String> iter = multipartRequest.getFileNames();
/*  53: 54 */         while (iter.hasNext())
/*  54:    */         {
/*  55: 55 */           MultipartFile file = multipartRequest.getFile((String)iter.next());
/*  56: 56 */           List<AlipayBillRecordVO> alipayBillRecordList = CSVReadUtils.readExistsHeaderCsvToObjectList(new InputStreamReader(file.getInputStream(), Charset.forName("GBK")), headers, AlipayBillRecordVO.class);
/*  57: 57 */           this.channelCheckService.saveAliPayBill(alipayBillRecordList);
/*  58:    */         }
/*  59:    */       }
/*  60: 60 */       rs.put("code", "0000");
/*  61: 61 */       rs.put("msg", "导入支付宝对账文件完成");
/*  62: 62 */       return JSON.toJSONString(rs);
/*  63:    */     }
/*  64:    */     catch (Exception e)
/*  65:    */     {
/*  66: 64 */       LogUtil.error("导入支付宝对账文件", e);
/*  67: 65 */       rs.put("code", "1001");
/*  68: 66 */       rs.put("msg", "系统异常请稍后再试");
/*  69:    */     }
/*  70: 67 */     return JSON.toJSONString(rs);
/*  71:    */   }
/*  72:    */   
/*  73:    */   @RequestMapping(value={"/uuBeeChannelCheckUpload"}, produces={"application/json;charset=UTF-8"})
/*  74:    */   @ResponseBody
/*  75:    */   public String uuBeeChannelCheckUpload(HttpServletRequest request, HttpServletResponse response)
/*  76:    */   {
/*  77: 76 */     Map<String, String> rs = new HashMap();
/*  78: 77 */     String[] headers = { "merchantOrder", "merchantNo", "merchantOrderCreatetime", "merchantBussinessNo", "uubeePayNo", "orderAmount", "merchantIncomExpenditure", "tradeState", "updateTime", "handlingCharge", "paymentProduct", "payType", "orderInfo" };
/*  79:    */     try
/*  80:    */     {
/*  81: 80 */       CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(request.getSession().getServletContext());
/*  82: 81 */       if (multipartResolver.isMultipart(request))
/*  83:    */       {
/*  84: 82 */         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
/*  85: 83 */         Iterator<String> iter = multipartRequest.getFileNames();
/*  86: 84 */         while (iter.hasNext())
/*  87:    */         {
/*  88: 85 */           MultipartFile file = multipartRequest.getFile((String)iter.next());
/*  89: 86 */           List<UubeeBillRecordVO> uubeeBillRecordList = CSVReadUtils.readExistsHeaderCsvToObjectList(new InputStreamReader(file.getInputStream(), Charset.forName("GBK")), headers, UubeeBillRecordVO.class);
/*  90: 87 */           this.channelCheckService.saveUuBeeBill(uubeeBillRecordList);
/*  91:    */         }
/*  92:    */       }
/*  93: 90 */       rs.put("code", "0000");
/*  94: 91 */       rs.put("msg", "导入有贝对账文件完成");
/*  95: 92 */       return JSON.toJSONString(rs);
/*  96:    */     }
/*  97:    */     catch (Exception e)
/*  98:    */     {
/*  99: 94 */       LogUtil.error("导入有贝对账文件完成", e);
/* 100: 95 */       rs.put("code", "1001");
/* 101: 96 */       rs.put("msg", "系统异常请稍后再试");
/* 102:    */     }
/* 103: 97 */     return JSON.toJSONString(rs);
/* 104:    */   }
/* 105:    */   
/* 106:    */   @RequestMapping(value={"/weChatChannelCheckUpload"}, produces={"application/json;charset=UTF-8"})
/* 107:    */   @ResponseBody
/* 108:    */   public String weChatChannelCheckUpload(HttpServletRequest request, HttpServletResponse response)
/* 109:    */   {
/* 110:105 */     CSVReadUtils.CsvCellFormatHander csvCellFormatHander = new CSVReadUtils.CsvCellFormatHander()
/* 111:    */     {
/* 112:    */       public String format(String propertyName, String value)
/* 113:    */       {
/* 114:107 */         return value.replaceAll("`", "");
/* 115:    */       }
/* 116:109 */     };
/* 117:110 */     Map<String, String> rs = new HashMap();
/* 118:    */     
/* 119:112 */     String[] headers = { "tradeTime", "pubAccountId", "merchantNo", "subMerchantNo", "deviceId", "wechatOrder", "merchantOrder", "userIdentity", "tradeType", "tradeState", "payBank", "currency", "totalAmount", "refundSuccessTime", "wechatRefundOrder", "merchantRefundOrder", "refundAmount", "refundRedpacketAmount", "refundType", "refundState", "goodsName", "merchantDatapacket", "handlingCharge", "rate" };
/* 120:    */     try
/* 121:    */     {
/* 122:115 */       CommonsMultipartResolver multipartResolver = new CommonsMultipartResolver(request.getSession().getServletContext());
/* 123:116 */       if (multipartResolver.isMultipart(request))
/* 124:    */       {
/* 125:117 */         MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest)request;
/* 126:118 */         Iterator<String> iter = multipartRequest.getFileNames();
/* 127:119 */         while (iter.hasNext())
/* 128:    */         {
/* 129:120 */           MultipartFile file = multipartRequest.getFile((String)iter.next()); CSVReadUtils 
/* 130:121 */             tmp273_270 = CSVReadUtils.getInstance();tmp273_270.getClass();
//List<WechatBillRecordVO> wechatBillRecordList = CSVReadUtils.readCsv(new InputStreamReader(file.getInputStream(), Charset.forName("GBK")), Arrays.asList(headers), Boolean.valueOf(true), WechatBillRecordVO.class, new CSVReadUtils.ObjectCsvImportRowHander(), csvCellFormatHander);
/* 131:122 */          // this.channelCheckService.saveWechatBill(wechatBillRecordList);
/* 132:    */         }
/* 133:    */       }
/* 134:125 */       rs.put("code", "0000");
/* 135:126 */       rs.put("msg", "导入微信对账文件完成");
/* 136:127 */       return JSON.toJSONString(rs);
/* 137:    */     }
/* 138:    */     catch (Exception e)
/* 139:    */     {
/* 140:129 */       LogUtil.error("导入微信对账文件", e);
/* 141:130 */       rs.put("code", "1001");
/* 142:131 */       rs.put("msg", "系统异常请稍后再试");
/* 143:    */     }
/* 144:132 */     return JSON.toJSONString(rs);
/* 145:    */   }
/* 146:    */   
/* 147:    */   @RequestMapping(value={"/listAlipayBillRecord"}, produces={"application/json;charset=UTF-8"})
/* 148:    */   @ResponseBody
/* 149:    */   public String listAlipayBillRecord()
/* 150:    */   {
/* 151:139 */     ResponseModle responseModle = null;
/* 152:    */     try
/* 153:    */     {
/* 154:141 */       List<AlipayBillRecordVO> alipayBillRecordList = this.channelCheckService.getAlipayBillRecord();
/* 155:142 */       responseModle = new ResponseModle("success", alipayBillRecordList);
/* 156:    */     }
/* 157:    */     catch (Exception e)
/* 158:    */     {
/* 159:144 */       LogUtil.error("查询支付宝对账文件异常", e);
/* 160:145 */       responseModle = new ResponseModle("error", new ArrayList());
/* 161:    */     }
/* 162:147 */     return JSON.toJSONString(responseModle);
/* 163:    */   }
/* 164:    */   
/* 165:    */   @RequestMapping(value={"/listUubeeBillRecord"}, produces={"application/json;charset=UTF-8"})
/* 166:    */   @ResponseBody
/* 167:    */   public String listUubeeBillRecord()
/* 168:    */   {
/* 169:153 */     ResponseModle responseModle = null;
/* 170:    */     try
/* 171:    */     {
/* 172:155 */       List<UubeeBillRecordVO> uuBeeBillRecordList = this.channelCheckService.getUubeeBillRecord();
/* 173:156 */       responseModle = new ResponseModle("success", uuBeeBillRecordList);
/* 174:    */     }
/* 175:    */     catch (Exception e)
/* 176:    */     {
/* 177:158 */       LogUtil.error("查询有贝对账文件异常", e);
/* 178:159 */       responseModle = new ResponseModle("error", new ArrayList());
/* 179:    */     }
/* 180:161 */     return JSON.toJSONString(responseModle);
/* 181:    */   }
/* 182:    */   
/* 183:    */   @RequestMapping(value={"/listWechatBillRecord"}, produces={"application/json;charset=UTF-8"})
/* 184:    */   @ResponseBody
/* 185:    */   public String listWechatBillRecord()
/* 186:    */   {
/* 187:167 */     ResponseModle responseModle = null;
/* 188:    */     try
/* 189:    */     {
/* 190:169 */       List<WechatBillRecordVO> weChatBillRecordList = this.channelCheckService.getWechatBillRecord();
/* 191:170 */       responseModle = new ResponseModle("success", weChatBillRecordList);
/* 192:    */     }
/* 193:    */     catch (Exception e)
/* 194:    */     {
/* 195:172 */       LogUtil.error("查询微信对账文件异常", e);
/* 196:173 */       responseModle = new ResponseModle("error", new ArrayList());
/* 197:    */     }
/* 198:175 */     return JSON.toJSONString(responseModle);
/* 199:    */   }
/* 200:    */ }


/* Location:           F:\work\pengyu\mainServer\WEB-INF\classes\
 * Qualified Name:     tt.dz.web.controller.channel.ChannelCheckController
 * JD-Core Version:    0.7.0.1
 */